home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 June
/
Macworld (1999-06).dmg
/
Shareware World
/
Info
/
For Developers
/
MacZoop2.0.sea
/
MacZoop2.0
/
Required Classes
/
MacZoop.h
< prev
next >
Wrap
Text File
|
1999-02-11
|
8KB
|
219 lines
/*************************************************************************************************
*
*
* MacZoop - "the framework for the rest of us"
*
*
*
* MacZoop.h -- standard defines and globals, always present. You can
* precompile this if you want.
*
*
* © 1996, Graham Cox
*
*
*
*
*************************************************************************************************/
#pragma once
#ifndef __MACZOOP__
#define __MACZOOP__
#include <QDOffscreen.h>
#include <CodeFragments.h>
#include <drag.h>
#include <AppleEvents.h>
#include <Quickdraw.h>
#include <Gestalt.h>
#include <sound.h>
#include "ZDefines.h"
#include "ZErrors.h"
#include "ZApplication.h"
#include "ZWindowManager.h"
#include "ZClipboard.h"
#include "ZMenuBar.h"
#include "ZTimer.h"
#include "CursorUtilities.h"
#include "ZoopUtilities.h"
// backward compatibility:
// MacZoop 1.8.2 and later require Universal Headers 3.0.1. However, older headers can be
// used since we hereby conditionally include a compatibility file which defines some of the
// newer constants
#ifndef __COMPATIBILITY__
#if UNIVERSAL_INTERFACES_VERSION < 0x0301
#include "Compatibility.h"
#endif
#endif
//----------------------------------------------------------------------------------------------
// Streaming support:
// If you want streaming support in your application, turn ON the following. Streaming requires
// the inclusion of numerous additional files to your project. For compatibility with earlier
// versions, the default is currently OFF. This may change in future versions. Most standard
// MacZoop classes now support streaming.
#define _MACZOOP_STREAMS 0
#if _MACZOOP_STREAMS
#include "ZClassRegistry.h"
#include "ZStream.h"
#endif
//----------------------------------------------------------------------------------------------
// Debugging:
// To assist debugging apps, you can turn on this flag. It affects the way that ASSERT is
// compiled- either to nothing (production), or to a diagnostic exception (debug)
#define _DEBUG_ 0
/************************************************************************************************/
// MacZoop reserves commands numbered 1-127 for the standard menu commands such as
// New, Open, Quit, Cut, Paste, etc. Your own commands should be numbered 128 and higher. You
// can use any command you wish for any purpose- MacZoop is ignorant of meanings attached to
// command numbers themselves. Since the command mapping tables are built on the fly at start-up,
// you are free to reorganise the menus however you want to suit your application- MacZoop will
// handle any standard commands present in the default manner, but doesn't care if they're not
// there, etc. This allows great flexibility in organising your application. Caveat: don't add
// items to the Apple Menu unless you are prepared to override the standard command handling.
// Standard commands:
enum
{
kNoCmd = 0, // 0 - no command (send menuID and itemID instead)
kCmdAbout = 1, // 1 - display the about box
kCmdNew, // 2 - make a new document or window
kCmdOpen, // 3 - display the open file dialog
kCmdClose, // 4 - close the active window
kCmdCloseAll, // 5 - close all windows
kCmdSave, // 6 - save the active window to disk
kCmdSaveAs, // 7 - display the save dialog
kCmdRevert, // 8 - revert the active window to its previous saved version
kCmdPageSetup, // 9 - display the page setup dialog
kCmdPrint, // 10 - display the print dialog and print the contents of the active window
kCmdQuit, // 11 - quit the application
kCmdUndo, // 12 - undo the last task
kCmdCut, // 13 - cut the selected item to the clipboard
kCmdCopy, // 14 - copy the selected item to the clipboard
kCmdPaste, // 15 - paste the clipboard contents
kCmdClear, // 16 - clear the selected item
kCmdSelectAll, // 17 - select everything in the active window
kCmdSelectNone, // 18 - select nothing in the active window
kCmdPlainText, // 19 - set plain text
kCmdBoldText, // 20 - set bold text
kCmdItalicText, // 21 - set italic text
kCmdUnderlineText, // 22 - set underlined text
kCmdOutlineText, // 23 - set outlined text
kCmdShadowText, // 24 - set shadowed text
kCmdCondensedText, // 25 - set condensed text
kCmdExtendedText, // 26 - set extended text
kCmdShowHideClipboard, // 27 - show or hide the clipboard window
kCmdDoPreferences, // 28 - open the prefs dialog, if any
kCmdSaveACopy, // 29 - save a copy of the current file
kCmdPrintOneCopy, // 30 - print a singlke copy of the current document
kCmdSetLeftJustify, // 31 - set text left justified
kCmdSetCentreJustify, // 32 - set text centre justified
kCmdSetRightJustify, // 33 - set text right justified
kCmdSetFullJustify // 34 - set full justify, where supported
};
// std commands for font size menu:
enum
{
kStdFontSizeBase = 100, // 100 - can be subtracted from font size command to yield actual size
kCmdStdFontSizeOther, // 101 - indicated "Other" font size- display font size dialog.
kCmdStdFontSize7 = 107, // 107 - font size 7
kCmdStdFontSize9 = 109, // 109 - font size 9
kCmdStdFontSize10, // 110 - font size 10
kCmdStdFontSize12 = 112, // 112 - font size 12
kCmdStdFontSize14 = 114, // 114 - font size 14
kCmdStdFontSize18 = 118, // 118 - font size 18
kCmdStdFontSize24 = 124, // 124 - font size 24
kCmdStdFontSize36 = 136, // 136 - font size 36
kCmdStdFontSize48 = 148, // 148 - font size 48
kCmdStdFontSize60 = 160, // 160 - font size 60
kCmdStdFontSize72 = 172 // 172 - font size 72
};
// std commands for a putative "colour" menu:
enum
{
kCmdSetColourBlack = 40, // 40 - set colour to black
kCmdSetColourWhite, // 41 - set colour to white
kCmdSetColourRed, // 42 - red
kCmdSetColourGreen, // 43 - green
kCmdSetColourBlue, // 44 - blue
kCmdSetColourCyan, // 45 - cyan
kCmdSetColourMagenta, // 46 - magenta
kCmdSetColourYellow, // 47 - yellow
kCmdSetColourOther // 48 - display colour picker
};
class ZPrefsFile;
// Global objects accessible from all classes:
extern ZApplication* gApplication; // the application object
extern ZWindowManager* gWindowManager; // the window manager object
extern ZMenuBar* gMenuBar; // the main menubar object
extern ZClipboard* gClipboard; // the clipboard object
extern ZPrefsFile* gPrefsFile; // the prefs file, if any
// Other globals
extern OSType gAppSignature; // creator type of this application
extern Boolean gIsAColourMac; // TRUE if we have any form of colour QD
extern tMacInfo gMacInfo; // other common gestalt results
extern RgnHandle gUtilRgn; // handy temporary region for general use
extern RGBColor gWhite; // white RGB colour
extern RGBColor gBlack; // black RGB colour
extern RGBColor gLightGray; // light gray
extern RGBColor gMidGray; // medium gray
extern RGBColor gDarkGray; // dark gray
extern RGBColor gRed; // solid red
extern RGBColor gGreen; // solid green
extern RGBColor gBlue; // solid blue
extern RGBColor gCyan; // solid cyan
extern RGBColor gMagenta; // solid magenta
extern RGBColor gYellow; // solid yellow
// static code called to kick the whole thing into life:
void RunApplication();
// ASSERT macros- handy for debugging. For "final" code, ASSERT maps to nothing so no overhead
// incurred within code by the checks made.
// <r> is a reason string, (C string), which is usually written as a literal- since it's only
// for debugging, there is no need to use resources or pascal formatted strings.
// <x> is an expression that evaluates to a Boolean. If FALSE, the assertion fails with a call
// to AssertErr. If TRUE, execution continues.
// The line number and file name are reported automatically, you can provide more info as you wish
// in your reason message.
#if _DEBUG_
#define ASSERT( r, x, v ) if ( !( x )) { AssertErr( __LINE__, __FILE__, r, v ); };
#else
#define ASSERT( r, x, v )
#endif
#endif